<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>lisence添加</title>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css" />
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/dtree/dtree.css" />
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/dtree/font/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/darkBlue.css"/>
</head>
<body>
<div class="page-content-wrap">
    <form class="layui-form">
        <div class="layui-tab" style="margin: 0 70px 70px 70px;">
            <div class="layui-tab-content">
                <!--<div class="layui-tab-item"></div>-->
                <div class="layui-tab-item layui-show">
                    <input type="hidden" class="form-control id" id="id" name="id" value="${sysLisenceManage.id}" />
                    <div class="layui-form-item layui-pop-tworow marlr50">
                        <label class="layui-form-label">lisence：</label>
                        <div class="layui-input-block">
                            <input type="text" name="lisence" required  lay-verify="required" placeholder="请输入lisence名称" value="${sysLisenceManage.lisence}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-pop-tworow marlr50">
                        <label class="layui-form-label">用户信息：</label>
                        <div class="layui-input-block">
                            <input type="text" name="userInfo" required lay-verify="required" placeholder="请输入用户信息" value="${sysLisenceManage.userInfo}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-pop-tworow marlr50">
                        <label class="layui-form-label">可建用户数量：</label>
                        <div class="layui-input-block">
                            <input type="text" name="personNum" required lay-verify="required" placeholder="可见用户数量" value="${sysLisenceManage.personNum}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item layui-pop-tworow marlr50">
                        <label class="layui-form-label">启用状态：</label>
                        <div class="layui-input-block">
                            <select name="status" id="status">
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item layui-pop-tworow marlr50">
                        <label class="layui-form-label">网络环境：</label>
                        <div class="layui-input-block">
                            <select name="type" id="type" lay-filter="type">
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item layui-pop-tworow marlr50">
                        <label class="layui-form-label">mac地址：</label>
                        <div class="layui-input-block">
                            <input type="text" name="macAddress"  lay-verify="required" placeholder="请输入mac地址" value="${sysLisenceManage.macAddress}" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item typeSelect layui-pop-tworow marlr50" >
                        <label class="layui-form-label">url地址：</label>
                        <div class="layui-input-block">
                            <input id ="url" type="text" name="url"  lay-verify="required" placeholder="请输入url地址" value="${sysLisenceManage.url}" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item layui-pop-tworow marlr50">
                        <label class="layui-form-label">版本号：</label>
                        <div class="layui-input-block">
                            <select name="versonId" required lay-verify="required"  id="Version" >
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item layui-pop-tworow marlr50">
                        <label class="layui-form-label">有效时间：</label>
                        <div class="layui-input-block ">
                            <input type="text" name="validTime" required lay-verify="required" placeholder="请输入有效时间" value="${sysLisenceManage.validTime}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item marlr50">
                        <label class="layui-form-label">lisence描述：</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" rows="3" style="resize: none; width: calc(100% - 20px)" name="description" lay-verify="content" placeholder="请输入应用描述" id="LAY_demo_editor">${sysLisenceManage.description}</textarea>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item layui-pop-btn">
            <div class="">
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="submitBtn">提交</button>
                <button type="button" id="cancel" class="layui-btn layui-btn-primary">取消</button>
                <button type="button" style="display: none;" id="save" class="layui-btn layui-btn-primary"></button>
            </div>
        </div>
    </form>
</div>

<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['form', 'jquery', 'laydate', 'layer', 'dialog','baseutil','page'], function() {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.jquery,
            baseutil = layui.baseutil,
            dialog = layui.dialog;
        var page = layui.page;
        page.initDict("base_status",function (dictData) {
            page.showDict($("#status"), page.aceeptDictContentList(dictData, "base_status"), "",'${sysLisenceManage.status}');
        });
        page.initDict("ServiceState",function (dictData) {
            page.showDict($("#type"), page.aceeptDictContentList(dictData, "ServiceState"), "",'${sysLisenceManage.type}');
        });
        page.initDictV("1",function(dictData) {
           page.showDictother($("#Version"), page.aceeptDictContentList(dictData, "1"), "选择需要关联的版本信息",'${sysLisenceManage.versonNumber}');
        });
        if('${baseLisenceManage.type}'=="1"){
            $(".typeSelect").show();
            $("#url").attr("lay-verify","required");
        }else {
            $(".typeSelect").hide();
            $("#url").removeAttr("lay-verify");
        }
      //监听下拉框
        form.on('select(type)', function(data){
            //1、在线 2离线
            if("1"==data.value){
                $(".typeSelect").show();
                $("#url").attr("lay-verify","required");
            }else{
                $(".typeSelect").hide();
                $("#url").removeAttr("lay-verify");
            }
        });
        //监听提交
        form.on('submit(submitBtn)', function(data){
            baseutil.post("/sysLisenceManage/addOrUpdate",data.field,function (result) {
                    debugger;
                    dialog.msg(result.data);
                    $("#save").click();
                });
            return false;
        });
    });
</script>
</body>

</html>